package com.cryann.mqttserver.modle;

import com.cryann.mqttserver.enums.ConfirmStatus;
import io.netty.channel.Channel;
import io.netty.handler.codec.mqtt.MqttMessageType;
import io.netty.handler.codec.mqtt.MqttQoS;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;

/**
 * @author cRyann
 * @date 2018/12/6 0006 11:58
 * @description:
 */
@Data
@Entity
public class MqttSendMessage {

    @Id
    @GenericGenerator(name = "idGenerator", strategy = "uuid")
    @GeneratedValue(generator = "idGenerator")
    private String id;

    private int crcLen;
    private byte[] crc;

    private int messageId;

    @Transient
    private Channel channel;

    private volatile ConfirmStatus confirmStatus;

    private long time;

    private byte[] byteBuf;

    private boolean isRetain;

    private MqttQoS qos;

    private String topic;

    private boolean isDup;

    private MqttMessageType messageType;

    private int remainingLength;
}
